package com.webdemo10.action;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.ActionSupport;
import com.webdemo10.pojo.User;
import com.webdemo10.service.UserService;
@Controller
@Namespace("/ssh/jsp")
@Action(value="deleteUser",results={@Result(location="queryUser",type="redirectAction")})
public class DeleteUser extends ActionSupport {

	private static final long serialVersionUID = 1L;
	@Autowired
	private UserService userService;
	private int id;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@Override
	public String execute() throws Exception {
		User user = userService.getUser(id);
		userService.deleteUser(user);
		return SUCCESS;
	}

}
